﻿
function WindowsMessageManager() {


    this.run = function (IsRootLevel)
    {
        if (IsRootLevel == null) {
            this.loadJssCssFile('../../Javascript/jquery-1.11.1.min.js', 'js');
            this.loadJssCssFile('../../Css/messi.css', 'css');
            this.loadJssCssFile('../../Javascript/messi.js', 'js');
        }
        else {
            console.log('root');
            this.loadJssCssFile('Css/messi.css', 'css');
            this.loadJssCssFile('Javascript/jquery-1.11.1.min.js', 'js');            
            this.loadJssCssFile('Javascript/messi.js', 'js');
        }
    }

    this.loadJssCssFile = function (filename, filetype) {
        if (filetype == "js") { 
            var fileref = document.createElement('script')
            fileref.setAttribute("type", "text/javascript")
            fileref.setAttribute("src", filename)
        }
        else if (filetype == "css") { 
            var fileref = document.createElement("link")
            fileref.setAttribute("rel", "stylesheet")
            fileref.setAttribute("type", "text/css")
            fileref.setAttribute("href", filename)
        }
        if (typeof fileref != "undefined")
            document.getElementsByTagName("head")[0].appendChild(fileref)
    }

    
    this.show_Success = function (message, title) {
        new Messi(message, {
            title: title,
            titleClass: 'success',
            buttons: [{
                id: 0,
                label: 'Aceptar', val: 'X'
            }], modal: true
        });
    }

    this.show_Info = function (message, title) {
        new Messi(message, {
            title: title,
            titleClass: 'info',
            buttons: [{
                id: 0,
                label: 'Aceptar', val: 'X'
            }], modal: true
        });
    }

    this.show_Warning = function (message, title) {
        new Messi(message, {
            title: title,
            titleClass: 'warning',
            buttons: [{
                id: 0,
                label: 'Aceptar', val: 'X'
            }], modal: true
        });
    }

    this.show_Error = function (message, title) {
        new Messi(message, {
            title: title,
            titleClass: 'anim error',
            buttons: [{
                id: 0,
                label: 'Aceptar', val: 'X'
            }], modal: true
        });
    }

    this.show_miniError = function (message, title) {
        new Messi(message, {
            title: title,
            titleClass: 'anim error',
            width: '300px',
            buttons: [{
                id: 0,
                label: 'Aceptar', val: 'X'
            }], modal: true
        });
    }

    this.show_SmallError = function (message, title) {
        new Messi(message, {
            title: title,
            titleClass: 'anim error',
            width: '200px',
            buttons: [{
                id: 0,
                label: 'Aceptar', val: 'X'
            }], modal: true
        });
    }
}